package a66weding.com.jiehuntong.activity.me;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import a66weding.com.jiehuntong.R;
import a66weding.com.jiehuntong.application.DataWareHourse;
import a66weding.com.jiehuntong.application.GlobalApplication;

/**
 * 这是我的-设置-修改手机号-显示已经绑定手机号的界面
 * Created by Administrator on 2016/7/14.
 */
public class MeYetBindPhoneActivity extends MeBaseActivity implements View.OnClickListener{
    private LinearLayout mBackLay;
    private TextView mBackContentTv;
    private TextView mHeaderTitleTv;
    private TextView mBindPhoneTv;
    private Button mChangePhone;
    private RelativeLayout mHeaderRightRlay;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_me_yet_bind_phone);
        ((GlobalApplication)getApplication()).getActivityManager().addActivity("MeYetBindPhoneActivity",this);  //全局的Activity的管理类
        ((GlobalApplication)getApplication()).getMeActivityManager().addActivity("MeYetBindPhoneActivity",this);//获取到我的Acivity管理类,向里添加

        initview();

    }

    private void initview() {
        mBackLay = (LinearLayout) findViewById(R.id.llay_header_back);
        mBackContentTv = (TextView) findViewById(R.id.tv_header_backcontent);
        mHeaderTitleTv = (TextView) findViewById(R.id.tv_header_title);
        mHeaderRightRlay = (RelativeLayout) findViewById(R.id.rlay_header_rightfunc);
        mBindPhoneTv = (TextView) findViewById(R.id.tv_me_bind_phone);
        mChangePhone = (Button) findViewById(R.id.btn_change_phone);

        mBackContentTv.setText("我的");
        mHeaderTitleTv.setText("绑定号码");
        mHeaderRightRlay.setVisibility(View.GONE);

        mBackLay.setOnClickListener(this);
        mChangePhone.setOnClickListener(this);
    }

    /**
     * 显示内容调用的方法
     */
    @Override
    protected void onResume() {
        super.onResume();
        String phoneNumber = DataWareHourse.getInstance().getmUser().getData().get(0).getNvc_MobilePhone();
        String passPhone = phoneNumber.substring(0,3)+"****"+phoneNumber.substring(7,phoneNumber.length()); //把获取到的手机号中间四位隐藏
        mBindPhoneTv.setText("已绑定"+passPhone+"号码");
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.llay_header_back:
                finish();
                break;
            case R.id.btn_change_phone:
                intent.setClass(MeYetBindPhoneActivity.this,MeAlterBindPhoneActivity.class);
                startActivity(intent);
                break;
        }
    }

}
